/*
 *  Class name: EditorControllerHelper.java
 *  Version: 1.0
 *  Date: 22.6.2014
 */

package cz.morosystems.personwebmanager.presentationlayer.controllers.utils;

import java.util.Locale;

/**
 *
 * @author Michal Ďuriš
 */
public class EditorControllerHelper {
    
    private static final String USER_EDITOR_VIEW = "editors/userEditor";
    private static final String BOOK_EDITOR_VIEW = "editors/bookEditor";
    private static final String ACCOUNT_EDITOR_VIEW = "editors/accountEditor";
    
    public static final String REDIRECT_HOME = "redirect:/index";
    
    private static final String REDIRECT_TO_USER_VIEW = "redirect:/viewdata?userID=";

    public static String redirectToEditorView(String entity) {
        
        switch (entity.toLowerCase(Locale.ROOT)) {
            
            case "user":
                return USER_EDITOR_VIEW;
                
            case "book":
                return BOOK_EDITOR_VIEW;
                
            case "account": 
                return ACCOUNT_EDITOR_VIEW;
                
            default: return "";
        }
    }

    public static String redirectToUserView(Long userID) {
        return REDIRECT_TO_USER_VIEW + userID;
    }

}
